package ynu.edu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import ynu.edu.mapper.IFoodMapper;
import ynu.edu.po.Food;
import ynu.edu.service.IFoodService;

import java.util.List;

@Service
public class FoodServiceImpl implements IFoodService {
    @Resource
    private IFoodMapper foodMapper;

    @Override
    public List<Food> listFoodByBusinessId(Integer businessId) {
        QueryWrapper<Food> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("businessId", businessId).orderByAsc("foodId");
        return foodMapper.selectList(queryWrapper);
    }

    @Override
    public Food getFoodById(Integer foodId) {
        return foodMapper.selectById(foodId);
    }

    @Override
    public List<Food> listAllFood() {
        QueryWrapper<Food> queryWrapper = new QueryWrapper<>();
        return foodMapper.selectList(queryWrapper);
    }
}
